Whistle Car
After being introduced to Python and Arduino in a few of the physics labs, a couple of my friends and I worked on developing an arduino car that could locomote in different directions based on the pitch of a whistle.
My friend, who was more comfortable in Arduino, wrote the C code to get to car to locomote in the 4 directions depending on the input. Meanwhile, I worked on the Python code, which, would read in sound through the computer's microphone, perform a live Fourier Transform on the incoming wave & return one of 4 possible characters depending on the frequency of sound. I was able to find a notebook which would read in sound through the computer's microphone, so I adapated this functionality in line with the fourier transforms which, when using a peak finding function on the transfromed data, would enable us to isolate single frequency values. I then integrated the Python software on Spyder with the arduino via an HC-05 bluetooth module. This module allowed me to connect to arduino through the serial monitor, where I could send single bit messages which would be interpreted by the C code.
One thing we were concerned about after testing the car, was that high frequencies didn't register too well, leading us to believe that this was a software issue on the FFT. We decided to perform an error analysis resulting in various similar forms of the above plot. This was surprising, as we were reading consistent frequencies tested against a frequency generator. Thus, we realized that our high pitch whistles must have been fractured, preventing us from fully controlling the car. To fix this, we shift down the frequency ranges and had a functional, sound controlled car.